Methods and systems for transparent depth sorting

ABSTRACT

Methods and systems for transparent depth sorting are described. In accordance with one embodiment, multiple depth buffers are utilized to sort depth data associated with multiple transparent pixels that overlie one another. The sorting of the depth data enables identification of an individual transparent pixel that lies closest to an associated opaque pixel. With the closest individual transparent pixel being identified, the transparency effect of the identified pixel relative to the associated opaque pixel is computed. If additional overlying transparent pixels remain, a next closest transparent pixel relative to the opaque pixel is identified and for the next closest pixel, the transparency effect is computed relative to the transparency effect that was just computed.

RELATED APPLICATION

This application is a continuation-in-part of, and claims priority toU.S. patent application Ser. No. 10/661,343, filed on Sep. 12, 2003, thedisclosure of which is incorporated by reference.

TECHNICAL FIELD

This invention relates to the field of computer graphics. Morespecifically, the present invention pertains to methods and systems forrendering objects.

BACKGROUND

Computer graphics systems typically utilize instructions, implementedvia a graphics program on a computer system, to specify calculations andoperations needed to produce two-dimensional or three-dimensionaldisplays. Exemplary graphics systems that include APIs that arecommercially available for rendering three-dimensional graphs includeDirect3D, available from Microsoft Corporation, of Redmond, Wash., andOpenGL by Silicon Graphics, Inc., of Mountain View, Calif.

Computer graphics systems can be envisioned as a pipeline through whichdata pass, where the data are used to define an image that is to beproduced and displayed. At various points along the pipeline, variouscalculations and operations that are specified by a graphics designerare used to operate upon and modify the data.

In the initial stages of the pipeline, the desired image is described bythe application using geometric shapes such as lines and polygons,referred to in the art as “geometric primitives.” The derivation of thevertices for an image and the manipulation of the vertices to provideanimation entail performing numerous geometric calculations in order toeventually project the three-dimensional world being synthesized to aposition in the two-dimensional world of the display screen.

Primitives are constructed out of “fragments.” These fragments haveattributes calculated, such as color and depth. In order to enhance thequality of the image, effects such as lighting, fog, and shading areadded, and anti-aliasing and blending functions are used to give theimage a more realistic appearance. The processes pertaining to perfragment calculation of colors, depth, texturing, lighting, etc., arecollectively known as “rasterization”.

The fragments and their associated attributes are stored in a framebuffer. Once rasterization of the entire frame has been completed, pixelcolor values can then be read from the frame buffer and used to drawimages on the computer screen.

To assist in understanding a typical computer graphics system, considerFIG. 1 which illustrates, generally at 100, a system that can implementa computer graphics process. System 100 comprises a graphics front end102, a geometry engine 104, a rasterization engine 106, and a framebuffer 108. System 100 can typically be implemented in hardware,software, firmware or combinations thereof, and is also referred to as a“rendering pipeline”.

Graphics front end 102 comprises, in this example, an application,primitive data generation stage 102 a and display list generation stage102 b. The graphics front end generates geographic primitive dataconsumed by the subsequent pipeline stage(s). Geographic primitive datais typically loaded from a computer system's memory and saved in adisplay list in the display list stage 102 b. All geometric primitivesare eventually described by vertices or points.

Geometry engine 104 comprises, in this example, high order surface (HOS)tessellation 104 a, and per-vertex operations stage 104 b. In stage 104a, primitive data is converted into simple rasterizer-supportedprimitives (typically triangles) that represent the surfaces that are tobe graphically displayed. Some vertex data (for example, spatialcoordinates) are transformed by four-by-four floating point matrices toproject the spatial coordinates from a position in the three-dimensionalworld to a position on the display screen. In addition, certain otheradvanced features can also be performed by this stage. Texturingcoordinates may be generated and transformed. Lighting calculations canbe performed using the vertex, the surface normal, material properties,and- other light information to it produce a color value. Perspectivedivision, which is used to make distant objects appear smaller thancloser objects in the display, can also occur in per-vertex operationsstage 104 b.

Rasterization engine 106 is configured to perform so-calledrasterization of the re-assembled rasterizer-supported primitives. Itcomprises the following stages: triangle/point assembly 106 a, setup 106b, parametric evaluation 106 c, depth and stencil operations stage 106d, per-fragment operations stage 106 e, and the blend and rasteroperations (ROP) stage 106 f.

Rasterization refers to the conversion of vertex data connected asrasterizer-supported primitives into “fragments.” Each fragmentcorresponds to a single element (e.g., a “pixel” or “sub-pixel”) in thegraphics display, and typically includes data defining color,transparency, depth, and texture(s). Thus, for a single fragment, thereare typically multiple pieces of data defining that fragment. To performits functions, triangle/point assembly stage 106 a fetches differentvertex components, such as one or multiple texture component(s), a colorcomponent, a depth component, and an alpha blending component (whichtypically represents transparency).

Setup stage 106 b converts the vertex data into parametric functioncoefficients that can then be evaluated on a fragment coordinate (eitherpixel or sub-pixel) by fragment coordinate basis. Parametric evaluationstage 106 c evaluates the parametric functions for all the fragmentswhich lie within the given rasterizable primitive, while conforming torasterizable primitive inclusion rules and contained within the framebuffer extents.

Depth and stencil operations stage 106 d perform depth operations on theprojected fragment depth and application specified fragment stenciloperations. These operations apply to both the comparison function onthe depth and stencil values, how the depth and stencil values should beupdated in the depth/stencil buffer and whether the fragment shouldterminate or continue processing. In the idealized rasterizationpipeline these operations take place just before frame buffer write-back(after blend and ROP stage 106 f), but commonly these operations arevalid before the per-fragment operations stage 106 e, which enablesearly termination of many fragments and corresponding performanceoptimizations/improvements.

Per-fragment operations stage 106 e typically performs additionaloperations that may be enabled to enhance the detail or lighting effectsof the fragments, such as texturing, bump mapping, per-fragmentlighting, fogging, and other like operations. Near the end of therasterization pipeline is the blend and raster operation (ROP) stage 106f, which implements blending for transparency effects and traditional 2Dblit raster operations. After completion of these operations, theprocessing of the fragment is complete and it is typically written toframe buffer 110 and potentially to the depth/stencil buffer 108. Thus,there are typically multiple pieces of data defining each pixel.

Now consider so-called “depth sorting” as it pertains to rendering 3Dgraphics. Depth sorting in computer graphics is typically accomplishedusing what is referred to as a “depth buffer”. A depth buffer, oftenimplemented as a “z-buffer” or a “w-buffer”, is a 2D memory array usedby a graphics device that stores depth information to be accessed by thegraphics device while rendering a scene. Typically, when a graphicsdevice renders a 3D scene to a render surface, it can use the memory inan associated depth buffer surface as a workspace to determine how thepixels or sub-pixels of rasterized polygons occlude one another. 11 Therender surface typically comprises the surface or buffer to which finalcolor values are written. The depth buffer surface that is associatedwith the render target surface is used to store depth information thattells the graphics device how deep each visible pixel or sub-pixel is inthe scene.

When a 3D scene is rasterized in a rasterization pipeline with depthbuffering enabled, each point on the rendering surface is typicallytested. A depth buffer that uses z values is often called a z-buffer,and one that uses w values is called a w-buffer. Implementations mayalternatively user other depth values such as 1/z or 1/w. While theseinvert the sense of increasing values with increasing depth, this factis typically hidden from the application and can therefore just bethought of as a simple z or w buffer.

At the beginning of rendering a scene to a render target surface, thedepth value in the depth buffer is typically set to the largest possiblevalue for the scene. The color value on the rendering surface is set toeither the background color value or the color values of the backgroundtexture at that point. Once a fragment has been generated at a givencoordinate (x,y) on the rendering surface, the depth value—which willbe, for example, the z coordinate in a z-buffer, and the w coordinate ina w-buffer—at the current coordinate is tested to see if it is smallerthan the depth value stored in the depth buffer. If the depth value ofthe polygon is smaller, it is stored in the depth buffer and the colorvalue from the polygon is written to the current coordinate on therendering surface. If the depth value of the polygon at that coordinateis larger, the fragment is terminated, so the depth buffer retains thesmallest value at the current coordinate. This process is shown foropaque polygons diagrammatically in FIG. 2.

There, notice that two polygons 200, 202 overlap along a ray that isassociated with a current coordinate 204 of interest. When the 3D sceneis rasterized, each coordinate on the rendering surface is typicallytested. Here, the corresponding location in depth buffer 206corresponding to pixel (or sub-pixel) 204 is set to the largest possiblevalue for the scene. The color value on the rendering surface for thislocation can be set to a background color. Polygons 200 and 202 areeffectively tested during rasterization to ascertain whether theyintersect with the current coordinate on the rendering surface. Sinceboth polygons intersect with the current coordinate on the renderingsurface, the depth value of polygon 200 at the current coordinate iseffectively tested to see whether it is smaller than the value at thecurrent coordinate in the depth buffer. Here, since the depth value ofthe polygon 200 for the associated coordinate is smaller than thecurrent depth value, the depth value for polygon 200 at the currentcoordinate is written to the depth buffer and the color value for thepolygon at the current coordinate is written to the correspondinglocation in the rendering surface (also referred to as the colorbuffer). Next, with the depth buffer holding the depth value for polygon200 at the current coordinate, the depth value of polygon 202 at thecurrent coordinate is tested against the current depth value in thedepth buffer. Since the depth value of polygon 202 at the currentcoordinate is smaller than the depth value of polygon 200 at the currentcoordinate, the depth value of polygon 202 at the current coordinate iswritten to the corresponding depth buffer location and the color valuefor polygon 202 at the current coordinate is written to thecorresponding location on the rendering surface.

In this manner, in the ultimately rendered image, overlapping portionsof polygon 202 at the current coordinate will occlude underlyingportions of polygon 200 at the current coordinate.

Now consider what is a fundamental problem in 3D graphics—that which isreferred to as transparent depth sorting.

To appreciate this problem, consider that there are typically twodifferent types of pixels—opaque pixels and transparent pixels. Opaquepixels are those pixels that pass no light from behind. Transparentpixels are those pixels that do pass some degree of light from behind.

Consider now FIG. 3 which shows a viewer looking at a scene through oneexemplary pixel 300 on a screen. When an object is rendered by a 3Dgraphics system, if the object is to appear as a realisticrepresentation of what a viewer would see in the real world, then thispixel should represent all of the light contributions, reflected backtowards the viewer, that lie along a ray R. In this example, ray Rintersects three different objects—an opaque mountain 302, a firsttransparent object 304 and a second transparent object 306. The nearestopaque pixel to the viewer is pixel 302 a which lies on the mountain.Because this pixel is opaque, no other pixels that might be disposedbehind this pixel on the mountain will make a contribution to theultimately rendered pixel.

In the real world, transparent objects 304, 306 cause the light that isreflected back towards the viewer to be affected in some way. That is,assume that objects 304, 306 are glass or windows that have some type ofcoloration and applied lighting and/or environmental effects. The effectof these windows is to slightly dim or otherwise attenuate the lightthat is associated with pixel 302 a then apply lighting and/orenvironmental effects. In the real world, the viewer's eye effectivelysums all of the light contributions to provide a realistic image of thedistant mountain. In the 3D graphics world, this is not an easy.

Specifically, assume that pixel 302 a has associated color values thatdescribe how that pixel is to be rendered without any transparencyeffects applied. The influence of the right side of object 304 at 304 a,and the left side of object 304 at 304 b, with applied lighting 308,will change the color values of the associated is pixel. Similarly, theinfluence of the right side of object 306 at 306 a, and the left side at306 b, with applied lighting 310, will further change the color valuesof the associated pixel.

Thus, if one wishes to accurately render pixel 302 a, one shouldnecessarily take into account the transparency and lighting effects ofthese lighted transparent objects, which requires back to front drawingordering of the transparent objects' contributions to the given pixel.

The traditional depth buffering techniques described above do nothing toalleviate the back to front rendering order problem. Specifically, thetraditional depth buffering techniques essentially locate the closestpixel (i.e. the pixel with the smallest z value) and then write thepixel's color values to the color buffer. There is no back to frontordering, with partial application of the overlying pixel's color values(and inversely partial retaining of the current color value). Thus,traditional depth buffering techniques do not take into account thistransparency issue.

There have been attempts in the past to solve this particulartransparency depth sorting issue. For example, one solution to thisproblem is to push the problem onto the application programmer. Forexample, the application programmer might resolve this issue by drawingall of the opaque objects first, and then perform some type ofinexpensive bounding box or bounding sphere processing, and present theresulting data to a graphics engine in back-to-front order. This canunnecessarily burden the application programmer.

Another general scheme to attempt to solve the transparency depthsorting problem is known as the “A-buffer” approach. This approachcreates a per pixel linked list of all of the pieces of per pixel dataas a frame is being drawn. For every pixel in the frame buffer, there isa linked list of fragments. These fragments embody the contributions ofthe various objects at the given coordinate that are in the scene. TheA-buffer approach is a very general method that essentially collects allof the linked list data for each pixel, and after all of linked listdata is collected, resolves the back to front issues, on a pixel bypixel basis, after the scene is completely drawn. In the context of aresource-rich environment where time is not a factor, this approach isacceptable as the software program simply operates on the data as thedata is provided to it.

One problem with the A-buffer approach, however, is most easilyappreciated in environments that are not necessarily resource-rich, andwhere time is, in fact, a factor, e.g. the gaming environment where itis desirable to render real time 3D graphics. With the A-bufferapproach, the size of the linked lists and all of the data in the linkedlists can be quite large. Today, it is not economical to have a framebuffer that is so large as to support the size of the linked lists.While the results that are produced using the A-buffer approach arenice, the costs associated with attaining such results are notappropriate for the real time environment.

Accordingly, this invention arose out of concerns associated withproviding improved graphics systems and methods.

SUMMARY

Methods and systems for transparent depth sorting are described. Inaccordance with one embodiment, multiple depth buffers are utilized tosort depth data associated with multiple transparent pixels that overlieone another in back to front order. The sorting of the depth dataenables identification of an individual transparent pixel that liesclosest to an associated opaque pixel. With the closest individualtransparent pixel being identified, the transparency effect of theidentified pixel relative to the associated opaque pixel is computed. Ifadditional overlying transparent pixels remain, a next closesttransparent pixel relative to the opaque pixel is identified and, forthe next closest pixel, the transparency effect is computed relative tothe transparency effect that was just computed. This process iteratesuntil there are no remaining overlying pixels in any transparent objectsbeing rasterized.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram that illustrates one type of computer graphicssystem.

FIG. 2 is a diagram that illustrates a depth sorting process thatutilizes a depth buffer.

FIG. 3 is a diagram that illustrates aspects of a computer graphicsscenario in which multiple transparent objects are employed.

FIG. 4 illustrates an exemplary system that can be utilized to implementthe various embodiments described herein.

FIG. 5 is a block diagram that illustrates a transparent -depth sortingcomponent in accordance with one embodiment.

FIG. 6 is a flow diagram and graphic that illustrates steps in a methodin accordance with one embodiment.

DETAILED DESCRIPTION

Overview

Reference will now be made in detail to exemplary embodiments, examplesof which are illustrated in the accompanying drawings. The describedembodiments are not intended to limit application of the claimed subjectmatter to only the specific embodiments described. On the contrary, theclaimed subject matter is intended to cover alternatives, modificationsand equivalents, which may be included within the spirit and scope ofvarious features of the described embodiments.

Furthermore, in the following detailed description, numerous specificdetails are set forth in order to provide a thorough understanding ofthe described embodiments. It is quite possible, however, for thevarious embodiments to be practiced without these specific details, butwith details that are different, but still within the spirit of theclaimed subject matter. In some instances, well-known methods,procedures, components, and circuits that are ancillary to, but supportthe claimed embodiments have not been described in detail so as not tounnecessarily obscure aspects of the embodiments that are described.

Some portions of the detailed descriptions which follow are presented interms of procedures, logic blocks, processing, and other symbolicrepresentations of operations on data bits within a computer memory orcache. These descriptions and representations are the means used bythose skilled in the data processing arts to most effectively convey thesubstance of their work to others skilled in the art. In the presentapplication, a procedure, logic block, process, or the like, isconceived to be a self-consistent sequence of steps or instructionsleading to a desired result. The steps are those requiring physicalmanipulations of physical quantities. Usually, although not necessarily,these quantities take the form of electrical or magnetic signals capableof being stored, transferred, combined, compared, and otherwisemanipulated in a computer system. It has proven convenient at times,principally for reasons of common usage, to refer to these signals astransactions, bits, values, elements, symbols, characters, fragments,pixels, pixel data, or the like.

In the discussion that follows, terms such as “processing,” “operating,”“calculating,” “determining,” “displaying,” or the like, refer toactions and processes of a computer system or similar electroniccomputing device. The computer system or similar electronic computingdevice manipulates and transforms data represented as physical(electronic) quantities within the computer system memories, registersor other such information storage, transmission or display devices.

The embodiments described below pertain to a graphics subsystem that isprogrammed or programmable to operate upon geometric primitive data thatis to be ultimately rendered to some type of display device. Thisgraphics subsystem can comprise an entire graphics engine, including atransform engine for geometry calculations, a raster componentcomprising one or more of texture components, specular components, fogcomponents, and alpha blending components, and any other components thatcan process application submitted and subsequent intermediate graphicsdata. In some embodiments, the graphics subsystem can be embodied in anintegrated circuit component.

Exemplary System

FIG. 4 illustrates an exemplary system 400 that can be utilized toimplement one or more of the embodiments described below. This system isprovided for exemplary purposes only and is not intended to limitapplication of the claimed subject matter.

System 400 exemplifies a computer-controlled, graphics system forgenerating complex or three-dimensional images. Computer system 400comprises a bus or other communication means 402 for communicatinginformation, and a processor 404 coupled with bus 402 for processinginformation. Computer system 400 further comprises a random accessmemory (RAM) or other dynamic storage device 406 (e.g. main memory)coupled to bus 402 for storing information and instructions to beexecuted by processor 404. Main memory 406 also may be used for storingtemporary variables or other intermediate information during executionof instructions by processor 404. A data storage device 408 is coupledto bus 402 and is used for storing information and instructions.Furthermore, signal input/output (I/O) communication device 410 can beused to couple computer system 400 onto, for example, a network.

Computer system 400 can also be coupled via bus 402 to an alphanumericinput device 412, including alphanumeric and other keys, which is usedfor communicating information and command selections to processor 404.Another type of user input device is mouse 414 (or a like device such asa trackball or cursor direction keys) which is used for communicatingdirection information and command selections to processor 404, and forcontrolling cursor movement on a display device 416. This input devicetypically has two degrees of freedom in two axes, a first axis (e.g., x)and a second axis (e.g., y), which allows the device to specifypositions in a plane.

In accordance with the described embodiments, also coupled to bus 402 isa graphics subsystem 418. Processor 404 provides graphics subsystem 418with graphics data such as drawing commands, coordinate vertex data, andother data related to an object's geometric position, color, and surfaceparameters. In general, graphics subsystem 418 processes the graphicaldata, converts the graphical data into a screen coordinate system,generates pixel data (e.g., color, depth, texture) based on theprimitives (e.g., points, lines, polygons, and meshes), and performsblending, anti-aliasing, and other functions. The resulting data arestored in a frame buffer 420. A display subsystem (not specificallyshown) reads the frame buffer and displays the image on display device416.

System 400 can be embodied as any type of computer system in whichgraphics rendering is to take place. In some embodiments, system 400 canbe embodied as a game system in which 3D graphics rendering is to takeplace. As will become apparent below, the inventive embodiments canprovide more realistic 3D rendering in a real time manner that isparticularly well suited for the dynamic environments in which gamesystem are typically employed.

Exemplary Embodiment Overview

In the embodiments described below, a solution to the transparent depthsorting problem is provided. In accordance with the describedembodiments, multiple depth buffers are employed to support a sortingprocess that is directed to incorporating the transparency effects ofany intervening transparent pixels on an associated opaque pixel thatlies behind it.

In accordance with the described techniques, after all of the opaquepixels are rendered to, for example, a rendering surface, the sortingprocess looks to identify, for an associated opaque pixel, the closesttransparent pixel that would overlie it or, from a viewer's perspective,be in front of it. When the sorting process finds the closesttransparent pixel, the rasterization pipeline processes the pixel dataassociated with the opaque pixel to take into account the effect thatthe closest transparent pixel has on the opaque pixel. This typicallyresults in the color values for the pixel of interest being modified.Once the color values are modified, the color values are written to theframe buffer for the pixel of interest. The sorting process then looksto identify the next closest transparent pixel and, if one is found, therasterization pipeline processes the pixel data associated with thecurrent pixel of interest to take into account the effect that the nextclosest transparent pixel has on the current pixel. Again, thistypically results in the color values for the pixel of interest beingmodified. Once the color values are modified, the modified color valuesare again written to the frame buffer for the pixel of interest. Thissorting process continues until, for a given pixel, no additionaloverlying transparent pixels are found.

The result of this process is that the transparency effects of overlyingpixels are taken into account, in back-to-front order, so that resultantpixels have associated color values that accurately represent what thepixel would look like.

Using Multiple Depth Buffers to Effect Transparent Depth Sorting

In the example about to be described, multiple depth buffers areutilized to effect transparent depth sorting. In this specific example,the depth buffers comprise z-buffers. It is to be appreciated that thetechniques described herein can be employed in connection withw-buffers, 1/w buffers, 1/z buffers, or other depth buffer types withoutdeparting from the spirit and scope of the claimed subject matter. Forexample, in one embodiment an inverse w-buffer that is Huffman encodedfor varying precision throughout the range of depth can be used.

In the example about to be described, two physical z-buffers areemployed. The hardware in the graphics subsystem understands twopointers and parameters for the two physical z-buffers. In accordancewith one embodiment, both of the z-buffers are readable, while only oneof the z-buffers is writable. The z-buffer that is both readable andwritable is referred to as the “destination buffer”, while the readableonly z-buffer is referred to as the “source buffer”. Additionally, inthe embodiment about to be described, support is provided for thegraphics software to be able to flip which buffer is considered thesource buffer and which buffer is considered the destination buffer. Theability to flip which buffers are considered as the source anddestination buffers effectively provides for a logical-to-physicalmapping of the source and destination buffers to the actual physicalbuffers, as will be appreciated by the skilled artisan. In oneembodiment, flipping the buffers is accomplished utilizing a multiplexeras input to the buffers address generation function. To flip thebuffers, the multiplexer select signal is flipped.

FIG. 5 shows a transparent depth sorting component 500 in accordancewith one embodiment. This component can reside at any suitable locationwithin the graphics processing pipeline. In one embodiment, component500 can reside in the graphics subsystem, such as subsystem 418 in FIG.4. Additionally, while the individual components of the transparentdepth sorting component 500 are shown to reside inside the component,such is not intended to constitute a physical limitation on thearrangement and location of components. Rather, the transparent depthsorting component can constitute a logical arrangement of components.Accordingly, individual constituent parts of the transparent depthsorting component 500 may not necessarily reside physically inside thecomponent 500.

As illustrated, component 500 comprises or makes use of a first z buffer502 (designated Z₀), a second z buffer 504 (designated Z₁), a zwriteback counter 506 and comparison logic 508. A frame buffer 510 isprovided and can be written to as a result of the processing that isundertaken by transparent depth sorting component 500, as will becomeapparent below.

FIG. 6 is a flow diagram that describes steps in a transparent depthsorting method in accordance with one embodiment. The method can beimplemented in connection with any suitable hardware, software, firmwareor combination thereof. In one embodiment, the method can be implementedusing a transparent depth sorting component such as the one illustratedand described in FIG. 5. Alternately or additionally, the method aboutto be described can be implemented using various components within agraphics subsystem, such as the one shown and described in FIG. 4.

In the method about to be described, two physical z-buffers areemployed—a first one designated z₀ and a second one designated z₁. Inthe FIG. 6 flow diagram, the contents in the individual buffers atvarious points in the described process will be indicated, just to theright of the flow diagram, underneath columns designated “z₀” and “z₁”which are grouped underneath encircled numbers which indicate aparticular pass in the process. So, for example, the first pass in theprocess is designated by an encircled “1”, the second pass in theprocess is designated by an encircled “2” and so on. This is intended-tohelp the reader follow along the described process. Also notice justbeneath the columns designated “z₀” and “z₁” appears an example thatshows, from a viewer's perspective, four different pixels that lie alonga particular ray. In this example, pixel A is an opaque pixel, andpixels B, C, and D constitute transparent pixels (in reverse order oftheir closeness to the viewer) which form the basis of the example thatis utilized to explain this embodiment. In this particular example, thedepth values of the pixels increase the further away from the viewerthat they appear. Thus, the depth value for pixel A is larger than thedepth value for pixel B, and so on.

In addition, recall that the notion of a “destination buffer” and a“source buffer” was introduced above. The destination buffer is a bufferthat is both readable and writable, while the source buffer is a bufferthat is only readable. In the explanation that follows, the physical zbuffers that are designated as the destination and source buffers willchange. To assist in keeping track of these changes, a parenthetical“dest” and “src” will appear in the column associated with the physicalbuffer that bears the associated designation.

Step 600 maps first z buffer z₀ as the destination z-buffer and step 602renders all of the opaque objects. The mapping of the first z bufferoperates to designate the second z buffer z₁ as the source z buffer.Rendering the opaque objects involves finding the opaque pixels that arethe closest opaque pixels to the viewer. Thus, rendering all of theopaque objects effectively obscures individual pixels that lie behindthe closest opaque pixel. When objects or pixels are rendered, what ismeant is that a series of primitives that represent the objects aredrawn. In some embodiments, -this means that the whole series oftriangles that represent the objects are drawn.

When the opaque objects are rendered, individual color values for theopaque objects are written to the frame buffer and their correspondingdepth values are written to the first z buffer z₀. Thus, in thisexample, for the illustrated ray, steps 600 and 602 result in the depthvalue for pixel A being written to the first z buffer z₀. At this point,the first z-buffer holds all of the depth data for all of the opaquepixels associated with the rendering surface.

What the algorithm will now attempt to do, for a ray that is cast for aparticular x, y coordinate for the frame buffer, is find the transparentpixel contribution that is as close as possible in depth and closer tothe viewer than the opaque pixel.

Accordingly, step 604 maps second z buffer z₁ as the destination zbuffer which effectively flips the logical mapping of the buffers, andsteps 606 and 608 respectively clear the destination z buffer andinitialize the destination z buffer to a predetermined value. In thisexample, the predetermined value comprises its smallest value. Thesmallest value in this example is the value associated with the closestdepth to the viewer—which is typically referred to as the “hitherplane”.

Step 610 clears a “z writeback counter” (e.g. component 506 in FIG. 5),which is utilized to keep track of writebacks that occur to thedestination z buffer. Step 612 sets the z compare logic to not write tothe frame buffer, but to write to the destination z buffer if a new zvalue is greater than the value in the destination z buffer (i.e. thehither plane value) and the new z value is less than the value in thesource buffer (i.e. the depth value of pixel A). This step is directedto set up the logic to ascertain the depth value of the transparentpixel that is closest and in front of the opaque pixel. In thisparticular example, the result of performing step 614, which renders allof the transparent objects, is that the depth value associated withpixel B is written into the destination buffer which, in this example,is the second z buffer z₁.

In the first pass the z buffer value is obtained. In the second pass(described below), the color value for the z buffer level found in thefirst pass is obtained, and the frame buffer is written to. This stepinvolves drawing the series of primitives that are associated with thetransparent objects. Step 616 ascertains whether the z writeback counteris equal to 0. If the z writeback counter is equal to 0, meaning that noz writebacks occurred, then the method terminates or exits. Effectively,exiting this process means that all of the transparency effects for therendering surface have been computed, back-to-front. In this particularsingle pixel example, since a z writeback occurred to account for thedepth value of pixel B, the process does not exit.

Step 618 maps z₀ as the destination z buffer which effectively flips thelogical mapping of the z buffers. Step 620 sets the z compare logic towrite to the frame buffer (i.e. rendering surface) and the z buffer ifthe new z value is equal to the value in the source z buffer (i.e. thevalue associated with pixel B) and the new z value is less than thevalue in the destination z buffer (i.e. the depth value of pixel A).Here, since the new z value is the value associated with pixel B, bothconditions are true, the frame buffer and the z buffer will be writtento. Step 622 then renders all of the transparent objects, during whichthe value associated with pixel B is written into the destination zbuffer.

Accordingly, in the first pass, the process has found the backmosttransparent pixel (i.e. pixel B) and has written color values associatedwith the transparency effects of pixel B out to-the frame buffer. Thisprovides, in the first pass, a transparency effect that incorporates thecontributions from pixel A and B. In the pass about to be described, thetransparency effects of pixel next closest to pixel B (i.e. pixel C)will be computed. Following that pass, the transparency of the nextclosest pixel (i.e. pixel D) will be computed.

Accordingly, step 622 returns to step 604 and maps second z buffer z₁ asthe destination z buffer which effectively flips the logical mapping ofthe buffers, and steps 606 and 608 respectively clear the destination zbuffer and initializes the destination z buffer to its smallestvalue—i.e. the hither value. Step 610 clears the z writeback counter andstep 612 sets the z compare logic to not write to the frame buffer, butto write to the destination z buffer if a new z value is greater thanthe value in the destination z buffer (i.e. the hither plane value) andthe new z value is less than the value in the source buffer (i.e. thedepth value of pixel B). This step is directed to set up the logic toascertain the closest transparent pixel to pixel B which is also infront of pixel B. In this particular example, the result of performingstep 614, which renders all of the transparent objects, is that thedepth value associated with pixel C is written into the destinationbuffer which, in this example, is the second z buffer z₁.

Step 616 ascertains whether the z writeback counter is equal to 0. Ifthe z writeback counter is equal to 0, meaning that no z writebacksoccurred, then the method exits. Effectively, exiting this process meansthat all of the transparency effects for the rendering surface have beencomputed, back-to-front. In this particular single pixel example, sincea z writeback occurred to account for the depth value of pixel C, theprocess does not exit.

Step 618 maps z₀ as the destination z buffer which effectively flips thelogical mapping of the z buffers. Step 620 sets the z compare logic towrite to-the frame buffer (i.e. rendering surface) and the z buffer ifthe new z value is equal to the value in the source z buffer (i.e. thevalue associated with pixel C) and the new z value is less than thevalue in the destination z buffer (i.e. the depth value of pixel B).Here, since the new z value is the value associated with pixel C, bothconditions are true, the frame buffer and the z buffer will be writtento. Step 622 then renders all of the transparent objects during whichthe value associated with pixel C is written into the destination zbuffer. At this point in the process, the transparency effects due topixel C have been accounted for in the rendering surface.

The method then returns to step 604 and maps second z buffer z₁ as thedestination z buffer which effectively flips the logical mapping of thebuffers, and steps 606 and 608 respectively clear the destination zbuffer and initializes the destination z buffer to its smallestvalue—i.e. the hither value. Step 610 clears the z writeback counter andstep 612 sets the z compare logic to not write to the frame buffer, butto write to the destination z buffer if a new z value is greater thanthe value in the destination z buffer (i.e. the hither plane value) andthe new z value is less than the value in the source buffer (i.e. thedepth value of pixel C). This step is directed to set up the logic toascertain the next closest transparent pixel to pixel C that liesbetween pixel C and the viewer. In this particular example, the resultof performing step 614, which renders all of the transparent objects, isthat the depth value associated with pixel D is written into thedestination buffer which, in this example, is the second z buffer z₁.

Step 616 ascertains whether the z writeback counter is equal to 0. Ifthe z writeback counter is equal to 0, meaning that no z writebacksoccurred, then the method exits. Effectively, exiting this process meansthat all of the transparency I effects for the rendering surface havebeen computed, back-to-front. In this particular single pixel example,since a z writeback occurred to account for the depth value of pixel D,the process does not exit.

Step 618 maps z₀ as the destination z buffer which effectively flips thelogical mapping of the z buffers. Step 620 sets the z compare logic towrite to the frame buffer (i.e. rendering surface) and the z buffer ifthe new z value is equal to the value in the source z buffer (i.e. thevalue associated with pixel D) and the new z value is less than thevalue in the destination z buffer (i.e. the depth value of pixel C).Here, since the new z value is the value associated with pixel D, bothconditions are true, the frame buffer and the z buffer will be writtento. Step 622 then renders all of the transparent objects, during whichthe value associated with pixel D is written into the destination zbuffer. At this point in the process, the transparency effects due topixel D have been accounted for in the rendering surface. The methodthen returns to step 604.

Without going through the flow diagram again, with the depth value forpixel D residing in the source z buffer due to the buffer flipping ofstep 604, the flow diagram will effectively, at step 616, exit theprocess as the z writeback counter will equal 0.

Thus, what has occurred at this point is that the individual transparentpixels have been depth sorted, back-to-front, and their individualeffects on given pixels have been taken into account in a realisticmanner. That is, the process described above effectively sorts the zvalues of individual pixels to find the depth of the transparent pixelthat is furthest away from the viewer and closest to an associatedopaque pixel that the transparent pixel affects. The transparencyeffects of this furthest most transparent pixel are computed and writtento the frame buffer. Then, the process repeats itself and looks for thetransparent pixel that is the next furthest most pixel away from theviewer and closest to the last transparent pixel. If found, thetransparency effects of the next furthest most transparent pixel iscomputed and written to the frame buffer. This process continues untilthere are no more transparent pixels along an associated ray. Thus, thetransparency effects of individual transparent pixels that lie along aparticular ray are taken into account in a back-to-front manner whichprovides realistic, real time computer graphics rendering.

Conclusion

The methods and systems described above can provide solutions to thetransparent depth sorting process that can result in more realistic 3Dgraphics rendering, particularly in scenarios in which real timerendering is appropriate.

Although the invention has been described in language specific tostructural features and/or methodological steps, it is to be understoodthat the invention defined in the appended claims is not necessarilylimited to the specific features or steps described. Rather, thespecific features and steps are disclosed as preferred forms ofimplementing the claimed invention.

1. A method comprising: sorting, using multiple depth buffers, depthdata associated with multiple transparent pixels that overlie oneanother to identify an individual pixel that lies closest to anassociated opaque pixel; computing a transparency effect of theidentified pixel relative to the associated opaque pixel; and after saidcomputing, identifying a next closest transparent pixel relative to theopaque pixel and computing, for the next closest pixel, a transparencyeffect relative to the transparency effect that was just computed. 2.The method of claim 1, wherein said multiple depth buffers comprise zbuffers.
 3. The method of claim 1, wherein said multiple depth bufferscomprise w buffers.
 4. The method of claim 1, wherein said multipledepth buffers comprise 1/w buffers.
 5. The method of claim 1, whereinsaid multiple depth buffers comprise 1/z buffers.
 6. The method of claim1, wherein said act of sorting comprises: identifying one of themultiple buffers as a destination buffer that is both readable andwritable; identifying another of the multiple buffers as a source bufferthat is only readable; and flipping which of the multiple buffers isconsidered as the destination buffer and the source buffer during saidacts of sorting, computing and identifying.
 7. The method of claim 1further comprising repeating said act of identifying for any additionaloverlying transparent pixels.
 8. A computing system configured toimplement the method of claim
 1. 9. An apparatus comprising: means forsorting, using multiple depth buffers, depth data associated withmultiple transparent pixels that overlie one another to identify anindividual pixel that lies closest to an associated opaque pixel; meansfor computing a transparency effect of the identified pixel relative tothe associated opaque pixel; and means for identifying a next closesttransparent pixel relative to the opaque pixel and computing, for thenext closest pixel, a transparency effect relative to the transparencyeffect that was just computed.
 10. The apparatus of claim 9, whereinsaid means for sorting and means for identifying comprises hardwarecomparison logic.
 11. A method comprising: (a) rendering at least oneopaque pixel that lies along a ray; (b) identifying a transparent pixelthat lies along the ray, the identified transparent pixel being theclosest transparent pixel to the opaque pixel; (c) computingtransparency effects of the identified transparent pixel relative to theopaque pixel; (d) if additional transparent pixels lie along the ray,identifying a next closest transparent pixel relative to the opaquepixel and computing transparency effects of the next closest pixelrelative to the computed transparency effects of a last computedtransparent pixel; and (e) repeating act (d) until transparency effectsof all of the transparent pixels along the ray have been computed in aback-to-front manner.
 12. The method of claim 11, wherein acts (a)-(e)are performed utilizing two physical depth buffers for sorting depthdata associated with the transparent pixels.
 13. The method of claim 11,wherein acts (a)-(e) are performed utilizing two physical depth buffersfor sorting depth data associated with the transparent pixels, andwherein the two depth buffers are configured to be flipped.
 14. Themethod of claim 11, wherein acts (a)-(e) are performed utilizing twophysical z buffers for sorting depth data associated with thetransparent pixels.
 15. The method of claim 1, wherein acts (a)-(e) areperformed utilizing two physical w buffers for sorting depth dataassociated with the transparent pixels.
 16. The method of claim 11,wherein acts (a)-(e) are performed utilizing two physical 1/w buffersfor sorting depth data associated with the transparent pixels.
 17. Themethod of claim 11, wherein acts (a)-(e) are performed utilizing twophysical 1/z buffers for sorting depth data associated with thetransparent pixels.
 18. The method of claim 11, wherein acts (a)-(e) areperformed utilizing two physical z buffers for sorting depth dataassociated with the transparent pixels, and wherein the two z buffersare configured to be flipped.
 19. The method of claim 11, wherein acts(a)-(e) are performed utilizing two physical w buffers for sorting depthdata associated with the transparent pixels, and wherein the two wbuffers are configured to be flipped.
 20. The method of claim 11,wherein acts (a)-(e) are performed utilizing two physical 1/w buffersfor sorting depth data associated with the transparent pixels, andwherein the two 1/w buffers are configured to be flipped.
 21. The methodof claim 11, wherein acts (a)-(e) are performed utilizing two physical1/z buffers for sorting depth data associated with the transparentpixels, and wherein the two 1/z buffers are configured to be flipped.22. The method of claim 11, wherein acts (a)-(e) are performed utilizingtwo physical depth buffers for sorting depth data associated with thetransparent pixels, and wherein performing acts (a)-(e) comprise:designating one of the depth buffers as readable and writable;designating the other of the depth buffers as readable only; andflipping the designations of the depth buffers.
 23. The method of claim11, wherein acts (a)-(e) are performed utilizing two physical z buffersfor sorting depth data associated with the transparent pixels, andwherein performing acts (a)-(e) comprise: designating one of the zbuffers as readable and writable; designating the other of the z buffersas readable only; and flipping the designations of the z buffers. 24.The method of claim 11, wherein acts (a)-(e) are performed utilizing twophysical w buffers for sorting depth data associated with thetransparent pixels, and wherein performing acts (a)-(e) comprise:designating one of the w buffers as readable and writable; designatingthe other of the w buffers as readable only; and flipping thedesignations of the w buffers.
 25. The method of claim 11, wherein acts(a)-(e) are performed utilizing two physical 1/w buffers for sortingdepth data associated with the transparent pixels, and whereinperforming acts (a)-(e) comprise: designating one of the 1/w buffers asreadable and writable; designating the other of the 1/w buffers asreadable only; and flipping the designations of the 1/w buffers.
 26. Themethod of claim 11, wherein acts (a)-(e) are performed utilizing twophysical 1/z buffers for sorting depth data associated with thetransparent pixels, and wherein performing acts (a)-(e) comprise:designating one of the 1/z buffers as readable and writable; designatingthe other of the 1/z buffers as readable only; and flipping thedesignations of the 1/z buffers.
 27. A computing system configured toimplement the method of claim
 11. 28. A system comprising: means forrendering at least one opaque pixel that lies along a ray; means foridentifying a transparent pixel that lies along the ray, the identifiedtransparent pixel being the closest transparent pixel to the opaquepixel; means for computing transparency effects of the identifiedtransparent pixel relative to the opaque pixel; and means foridentifying, in a back-to-front manner, additional transparent pixelsand successively computing transparency effects for the additionaltransparent pixels.
 29. The system of claim 28, wherein said means forrendering comprises a graphics subsystem.
 30. The system of claim 28,wherein said means for identifying comprises a pair of physical depthbuffers.
 31. The system of claim 28, wherein said means for identifyingcomprises a pair of physical depth buffers that can be logicallyflipped.
 32. A system comprising: a transparent depth sorting componentcomprising: at least two physical depth buffers; a writeback counter tocount writebacks that occur to at least one of the two physical depthbuffers; and comparison logic that is configured to effect: sorting,using said at least two physical buffers, of depth data associated withmultiple transparent pixels that overlie one another to identify anindividual pixel that lies closest to an associated opaque pixel;computing a transparency effect of the identified pixel relative to theassociated opaque pixel; after said computing, identifying a nextclosest transparent pixel relative to the opaque pixel; and computing,for the next closest pixel, a transparency effect relative to thetransparency effect that was computed for the said closest individualpixel and the associated opaque pixel.
 33. The system of claim 32,wherein: one of said at least two physical depth buffers is capable ofbeing designated as readable and writable; another of said at least twophysical depth buffers is capable of being designated as readable only;and designations of said at least two physical depth buffers are capableof being flipped.
 34. The system of claim 32, wherein said at least twophysical depth buffers comprise z buffers.
 35. The system of claim 32,wherein said at least two physical depth buffers comprise w buffers. 36.The system of claim 32, wherein said at least two physical depth bufferscomprise 1/w buffers.
 37. The system of claim 32, wherein said at leasttwo physical depth buffers comprise 1/z buffers.
 38. The system of claim32, wherein said transparent depth sorting component is configured toterminate transparent depth sorting when the writeback counter indicatesthat no writebacks have occurred.
 39. A graphics subsystem embodying thetransparent depth sorting component of claim
 32. 40. A computer systemembodying the graphics subsystem of claim
 39. 41. A method comprising:mapping a first of two depth buffers as a destination buffer that isreadable and writable, a second of the two depth buffers beingdesignated as a source buffer that is only readable; rendering one ormore opaque objects having associated opaque pixels; writing a depthvalue associated with an opaque pixel to the first buffer; mapping thesecond of the depth buffers as the destination buffer, the first of thedepth buffers being designated as the source buffer; initializing thedestination buffer to a predetermined value; effecting a comparison of anew pixel depth value with values in the source and destination buffersand writing the new pixel depth value to the destination buffer if thenew pixel depth value is (a) greater than the value currently in thedestination buffer and (b) less than the value in the source buffer,effective to write a new pixel depth value that is associated with apixel that is closest to a pixel whose depth value is contained in thesource buffer; rendering one or more transparent objects havingassociated transparent pixels; determining if transparency effects forall transparent pixels in all transparent objects have been accountedfor and if so, terminating processing and, if not: mapping the first ofthe depth buffers as the destination buffer, the second of the buffersbeing designated as the source buffer; effecting a comparison of the newpixel depth value with values in the source and destination buffers andwriting to a frame buffer and the destination buffer if the new pixeldepth value is equal to the value in the source buffer and the new pixeldepth value is less than the value in the destination buffer; renderingone or more transparent objects; and returning to said act of mappingthe second of the depth buffers until transparency effects of alltransparent pixels in all the transparent objects have been accountedfor.
 42. The method of claim 41, wherein said predetermined valuecomprises a depth buffer's smallest value.
 43. The method of claim 41,wherein said act of determining is performed by maintaining a depthbuffer writeback counter that keeps track of depth buffer writebacks.44. The method of claim 41, wherein the depth buffers comprise zbuffers.
 45. The method of claim 41, wherein the depth buffers comprisew buffers.
 46. The method of claim 41, wherein the depth bufferscomprise 1/w buffers.
 47. The method of claim 41, wherein the depthbuffers comprise 1/z buffers.
 48. A computing system configured toimplement the method of claim
 41. 49. A system comprising: a processor;at least two depth buffers; a frame buffer; and a graphics subsystemoperably connected with the processor and configured to, under theinfluence of the processor: map a first of the depth buffers as adestination buffer that is readable and writable, a second of the depthbuffers being designated as a source buffer that is only readable;render one or more opaque objects having associated opaque pixels; writea depth value associated with an opaque pixel to the first buffer; mapthe second of the depth buffers as the destination buffer, the first ofthe depth buffers being designated as the source buffer; initialize thedestination buffer to a predetermined value; effect a comparison of anew pixel depth value with values in the source and destination buffersand write the new pixel depth value to the destination buffer if the newpixel depth value is (a) greater than the value currently in thedestination buffer and (b) less than the value in the source buffer,effective to write a new pixel depth value that is associated with apixel that is closest to a pixel whose depth value is contained in thesource buffer; render one or more transparent objects having associatedtransparent pixels; determine if transparency effects for alltransparent pixels in all the transparent objects have been accountedfor and if so, terminate processing and, if not: map the first of thedepth buffers as the destination buffer, the second of the buffers beingdesignated as the source buffer; effect a comparison of the new pixeldepth value with values in the source and destination buffers and writeto the frame buffer and the destination buffer if the new pixel depthvalue is equal to the value in the source buffer and the new pixel depthvalue is less than the value in the destination buffer; render one ormore transparent objects; and return to said mapping the second of thedepth buffers until transparency effects of all transparent pixels inall the transparent objects have been accounted for.
 50. The system ofclaim 49, wherein said predetermined value comprises a depth buffer'ssmallest value.
 51. The system of claim 49 further comprising a depthbuffer writeback counter that keeps track of depth buffer writebacks.52. The system of claim 49, wherein the depth buffers comprise zbuffers.